<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> 卸载事件 </title>
<script type="text/javascript">  
     window.onUnload = onunload_message();  
     function onunload_message(){  
        alert("您确定离开该网页吗？");  
    }  
</script>  
</head>
<body>
  欢迎学习JavaScript。
</body>
</html>

